<template>
  <div>
    <!-- 顶栏 -->
    <div class="topbar bg-top py-2 px-3 d-flex ai-center">
      <img src="../assets/images/logo.png" height="33" />
      <div class="px-2 flex-grow-1">
        <div class="text-white fs-lg">王者荣耀</div>
        <div class="text-dark-2 fs-xxs">团队成就更多</div>
      </div>
      <button class="btn bg-primary">立即下载</button>
    </div>
    <!-- 导航 -->
    <div class="bg-primary pt-3 pb-2">
      <div class="nav nav-inverse pb-1 jc-around">
        <div class="nav-item" :class="{active: active === 0}" @click="() => active = 0">
          <router-link to="/" class="nav-link fs-lg" tag="div">首页</router-link>
        </div>
        <div class="nav-item" :class="{active: active === 1}" @click="() => active = 1">
          <router-link to="/strategy" class="nav-link fs-lg" tag="div">攻略中心</router-link>
        </div>
        <div class="nav-item" :class="{active: active === 2}" @click="() => active = 2">
          <router-link to="/competition" class="nav-link fs-lg" tag="div">赛事中心</router-link>
        </div>
      </div>
    </div>

    <router-view></router-view>
  </div>
</template>

<script>
export default {
  data() {
    return {
      active: 0
    }
  },
}
</script>

<style lang="scss">
.topbar {
  //吸顶效果，较新的写法
  position: sticky;
  top: 0;
  z-index: 999;
}
</style>
